﻿namespace Quail.DbLogger.Task
{
	/// <summary>
	/// Wraps inserting a new TestRunTask Attribute
	/// </summary>
    public class InsertTestRunTaskAttribute : QuailDbLoggerEntry
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="InsertTestRunTaskAttribute"/> class.
        /// </summary>
        /// <param name="testruntaskid">The testruntaskid.</param>
        /// <param name="name">The name of the attribute.</param>
        /// <param name="value">The value.</param>
        public InsertTestRunTaskAttribute(long testruntaskid, string name, string value)
        {
            TestRunTaskId = testruntaskid;
            Name = name;
            Value = value;
        }

        private long TestRunTaskId { get; set; }

        private string Name { get; set; }

        private string Value { get; set; }

        /// <summary>
        /// Inserts a new test run task attribute
        /// </summary>
        /// <param name="dataContext">the context to use</param>
        public override void Store(QuailServices.QuailDataServiceReference.QuailDataServiceClient dataContext)
        {
            var testRunTaskAttributeId = dataContext.InsertTestRunTaskAttribute(TestRunTaskId, Name, Value);
        }

        /// <summary>
        /// Returns a string representation of the entry for logging purposes
        /// </summary>
        /// <returns>A log string</returns>
        public override string GetLogDetail()
        {
            return string.Format("InsertTestRunTaskAttribute({0},{1},{2})", TestRunTaskId, Name, Value);
        }
    }
}
